package cn.com.guage.single.idler;

/**
 * 懒汉式-方式1（线程不安全）
 * @author yangdechao
 *
 */
public class Singleton1 {

	private static Singleton1 instance;

	public Singleton1() {
	}

	public static Singleton1 getInstance() {
		if(instance == null) {
			instance = new Singleton1();
		}
		return instance;
	}
	
	public void say() {
		System.out.println("say");
	}

	public static void main(String[] args) {
		Singleton1 instance1 = Singleton1.getInstance();
		System.out.println(instance1);
		instance1.say();
		Singleton1 instance2 = Singleton1.getInstance();
		System.out.println(instance2);
	}

}
